#include "mainscene.h"
#include "choosewindow.h"
#include "ui_mainscene.h"
#include<QPainter>
#include<QDesktopServices>
#include<QUrl>
#include<QString>
#include<QMessageBox>
MainScene::MainScene(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainScene)
{
    ui->setupUi(this);
    //创建车和人

    //创建射击场景
    ChooseScene = new ChooseWindow;
    connect(ui->StartButton,&QPushButton::clicked,this,[=](){
        this->hide();
        ChooseScene->show();
    });
    connect(this->ui->actionAbout,&QAction::triggered,[=](){
        QMessageBox::warning(this,"警告","本游戏仅供娱乐，不代表任何政治立场\n制作人：2111212王观涛 ");
    });
    //创建网页链接
    connect(ui->BackgroundStory,&QPushButton::clicked,this,[=](){QDesktopServices::openUrl(QUrl(QString("https://baike.baidu.com/item/%E7%BA%A6%E7%BF%B0%C2%B7%E8%82%AF%E5%B0%BC%E8%BF%AA%E9%81%87%E5%88%BA%E6%A1%88/2409904?fromtitle=%E8%82%AF%E5%B0%BC%E8%BF%AA%E9%81%87%E5%88%BA%E6%A1%88&fromid=4545164&fr=aladdin")));});
}
//背景图
void MainScene::paintEvent(QPaintEvent *){
    QPainter painter(this);
    QPixmap pix;
    pix.load(":/Start.jpeg");
    painter.drawPixmap(0,0,this->width(),this->height(),pix);
}

MainScene::~MainScene()
{
    delete ui;
}

